import request  from  '@/utils/request.js'

// 获取用户管理列表  
export const reqUserList = (page, limit,username)=>{
    return request({url: `/admin/acl/user/${page}/${limit}?username=${username}`, method: 'get'})
}

// 保存用户
export const reqSaveUser = (user)=> {
    return request({url: "/admin/acl/user/save", method: 'post', data: user})
}

// 更新用户 /admin/acl/user/update
export const reqUpdateUser = (user)=>{
    return request({url: "/admin/acl/user/update", method: 'put', data: user})
}   

// 删除用户
export const reqDeleteUser = (id)=>{
    return request({url: `/admin/acl/user/remove/${id}`, method: 'delete'})
}   

// 获取某一个用户的角色
export const reqUserRole=(id) => {
    return request({url: `/admin/acl/user/toAssign/${id}`, method: 'get'})
}

// 保存用户的角色 /admin/acl/user/doAssign?userId={string}&roleId={0,1,1802991451406749697,1808771134}
export const reqSaveUserRoles=(userId,roleId)=> {
    return request({url: `/admin/acl/user/doAssign?userId=${userId}&roleId=${roleId}`, method: 'post'})
}